home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / Halves scroll reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.7 KB  |  54 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 3
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6.  
  7. pascal short HalvesScrollReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  8.  
  9. /* 2 regions, split down the middle of the screen.  Scroll the screen down in one
  10.    region and up in the other. */
  11.    
  12. pascal short HalvesScrollReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  13. {
  14.     short            x;
  15.     Rect        theTopRect, topdest, theBottomRect, bottomdest;
  16.     Rect        topscrollsource, bottomscrollsource;
  17.     short            cx;
  18.     short            BoxSize;
  19.     
  20.     BoxSize=theWindowHeight/25;
  21.     cx = boundsRect.left + theWindowWidth / 2;
  22.     
  23.     topscrollsource=topdest=bottomscrollsource=bottomdest=boundsRect;
  24.     topscrollsource.left=topdest.left=bottomscrollsource.right=bottomdest.right=cx;
  25.     topdest.bottom=topdest.top+BoxSize;
  26.     bottomdest.top=bottomdest.bottom-BoxSize;
  27.     
  28.     SetRect(&theTopRect, cx, boundsRect.bottom-BoxSize, boundsRect.right, boundsRect.bottom);
  29.     SetRect(&theBottomRect, boundsRect.left, boundsRect.top, cx, boundsRect.top+BoxSize);
  30.     
  31.     for(x = theWindowHeight - BoxSize; x >= 0; x -= BoxSize)
  32.     {
  33.         StartTiming();
  34.         ScrollTheRect(&topscrollsource, 0, BoxSize, 0L);
  35.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  36.                 &theTopRect, &topdest, 0, 0L);
  37.         theTopRect.bottom-=BoxSize;
  38.         theTopRect.top-=BoxSize;
  39.         
  40.         ScrollTheRect(&bottomscrollsource, 0, -BoxSize, 0L);
  41.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  42.                 &theBottomRect, &bottomdest, 0, 0L);
  43.         theBottomRect.top+=BoxSize;
  44.         theBottomRect.bottom+=BoxSize;
  45.         
  46.         TimeCorrection(CorrectTime);
  47.     }
  48.     
  49.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  50.         &boundsRect, &boundsRect, 0, 0L);
  51.     
  52.     return 0;
  53. }
  54.